-
-
Notifications
You must be signed in to change notification settings - Fork 9.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use curl_headers
and curl_output
for Livecheck
strategies.
#15351
Conversation
231edfb
to
2a4cc62
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As mentioned in #15117 (review), #curl_head
is catered to the needs of CurlDownloadStrategy
and isn't currently suitable for livecheck (namely, HeaderMatch
).
For example, #curl_head
will retry a request if a Content-Disposition
header isn't present. This may be appropriate behavior for CurlDownloadStrategy
but it doesn't make sense for livecheck, where we overwhelmingly check Location
headers (and only a handful of those checks also provide a Content-Disposition
header). Any retry behavior needs to be tied to the actual header(s) we're checking and #curl_head
doesn't have a way of understanding that or controlling that behavior. As it stands, the hundreds of checks that check a Location
header but don't contain responses with a Content-Disposition
header would end up needlessly retrying with a GET
request.
Besides that, the retry behavior is a mandatory part of #curl_head
and there's currently no way to opt out or specify which request method to use (e.g., GET
). There will be scenarios in the future where we specify the request method in a livecheck
block (after the options
feature is available) and that should effectively disable any automatic retry behavior. This would ensure that we make the correct request the first time, reducing the burden on upstream servers.
With that in mind, I'm of the opinion that the retry logic that's currently in #curl_head
should be moved into CurlDownloadStrategy#resolve_url_basename_time_file_size
, where it would check for a failed request or the lack of a Content-Disposition
header and call #curl_head
again with a GET
request. This would make #curl_head
a general-purpose method that could be used in livecheck. In this scenario, we would also add contextually-appropriate error-handling in livecheck, where #curl_head
(or #page_headers
) would be run again.
I'm not explicitly against using a general-purpose #curl_head
method in Strategy#page_headers
but, as mentioned, #curl_head
would need some rework and we would still need some contextually-appropriate retry logic in livecheck (probably in HeaderMatch
). However, I am against using #curl_head
in livecheck as-is.
Currently they are all using Also, I would imagine most |
This should not block on potential future scenarios, that's not very fair on @reitermarkus.
@samford am I right in saying this is the sole blocker, from your perspective, on this PR being merged? If so, does this seem reasonable to you @reitermarkus? |
I agree that we should use
As mentioned in #15117 (review), we have ~231 checks where only a This is worse than the status quo because it doubles the requests and we see no benefit from it. Keep in mind that ~88% of existing
Specifying the request method in a
Basically yes but Markus and I may have differing views on what I agree with the idea of using From my perspective, the
|
Ok, I'll take that as "yes" and @reitermarkus, assuming you're OK with that, please progress accordingly and we can ✅ and merge.
This makes very little sense to me. The entire point of that method is to make a |
The goal of the method is to fetch/return only the headers of the response(s). The idea of an optional parameter to use |
In that case: |
I agree. Most people looking at the method are likely to think the same thing that you did and |
Also, just to be clear, we don't need to handle the livecheck retry logic in this PR. All that's needed here is to rework If we move forward with the |
2a4cc62
to
545a332
Compare
curl_head
and curl_output
for Livecheck
strategies.curl_headers
and curl_output
for Livecheck
strategies.
Looks good to me, thanks @reitermarkus! |
@reitermarkus I'm seeing an error on a number of livechecks
|
I was coming to submit my review and explain the technical issues here (I just finished collecting data, testing, etc.) but apparently didn't make it in time. As-is, this breaks all the I'll create a follow-up PR with fixes and explanations (#15389). |
@samford That this doesn't happen automatically with any of our CI suites is the problem here, not that @reitermarkus missed this or that you didn't review it in time. You need to figure out a way of automating things that doesn't rely on you catching things before they are merged. It's a reasonable assumption for Homebrew maintainers to be able to merge a PR if the code looks good and the CI looks good. |
brew style
with your changes locally?brew typecheck
with your changes locally?brew tests
with your changes locally?#15099 seems to be stalled, so I'm adding the
curl_head
usage here. Also switch tocurl_output
instead of directly callingcurl_with_workarounds
.